const {connect, mongoose} = require('./index');
const Schema = mongoose.Schema;
const Mixed = Schema.Types.Mixed;

module.exports = {
    async insertData(clitions) {
        console.log(clitions)
        const circumSchema = new Schema({
            swipe: Array,
            section_box_adv: Array,
            index_center_wrapper: Array,
            section_phone_box: Array,
            index_accessory_center: Array,
            site_nav_bd: Array,
            meizu_footer_link: Array
        });
        circumSchema.static('findData', function ({obj, obj_1, callback}) {
            return this.find(obj, obj_1).sort({sort: 1}).exec(callback);
        })

        let circumModel = mongoose.model(clitions, circumSchema);
        await connect();

        // await mongoose.connection.collection(clitions).drop(function (err) {
        //     if (err) {
        //         return;
        //     }
        //     console.log('删除成功集合成功')
        // });

        return Promise.resolve(circumModel);

    }
};



